/*     */ package com.feeyin.radar.task;
/*     */ 
/*     */ import com.feeyin.radar.commons.DateUtils;
/*     */ import com.feeyin.radar.commons.FileUtils;
/*     */ import com.feeyin.radar.commons.StringUtils;
/*     */ import com.feeyin.radar.msg.service.WarningInfoService;
/*     */ import com.feeyin.radar.sys.dao.BackupDataDAO;
/*     */ import com.feeyin.radar.sys.model.BackupData;
/*     */ import com.feeyin.radar.sys.service.CommonSettingsService;
/*     */ import java.io.File;
/*     */ import java.io.PrintStream;
/*     */ import java.net.URL;
/*     */ 
/*     */ public class PlanTask
/*     */ {
/*     */   private BackupDataDAO backupDataDAO;
/*     */   private WarningInfoService warningInfoService;
/*     */   private CommonSettingsService commonSettingsService;
/*     */ 
/*     */   public BackupDataDAO getBackupDataDAO()
/*     */   {
/*  35 */     return this.backupDataDAO;
/*     */   }
/*     */ 
/*     */   public void setBackupDataDAO(BackupDataDAO backupDataDAO) {
/*  39 */     this.backupDataDAO = backupDataDAO;
/*     */   }
/*     */ 
/*     */   public WarningInfoService getWarningInfoService() {
/*  43 */     return this.warningInfoService;
/*     */   }
/*     */ 
/*     */   public void setWarningInfoService(WarningInfoService warningInfoService) {
/*  47 */     this.warningInfoService = warningInfoService;
/*     */   }
/*     */ 
/*     */   public CommonSettingsService getCommonSettingsService() {
/*  51 */     return this.commonSettingsService;
/*     */   }
/*     */ 
/*     */   public void setCommonSettingsService(CommonSettingsService commonSettingsService) {
/*  55 */     this.commonSettingsService = commonSettingsService;
/*     */   }
/*     */ 
/*     */   public void executeByBuckup()
/*     */   {
/*  62 */     System.out.println("auto backup job........");
/*  63 */     String classPath = Thread.currentThread().getContextClassLoader().getResource("").toString();
/*  64 */     String realPath = classPath.substring(6);
/*  65 */     realPath = realPath.substring(0, realPath.indexOf("WEB-INF"));
/*  66 */     insertBackupData(realPath, "2");
/*     */   }
/*     */ 
/*     */   public void executeByScheduleWaring()
/*     */   {
/*  73 */     System.out.println("auto ScheduleWaringInfo job........");
/*  74 */     this.warningInfoService.insertScheduleWarningInfo();
/*     */ 
/*  76 */     System.out.println("auto openSeaWaringInfo job........");
/*  77 */     this.commonSettingsService.moveOverDueCustomers();
/*  78 */     this.commonSettingsService.warningOverDueCustomers();
/*     */   }
/*     */ 
/*     */   public void executeByOther()
/*     */   {
/*  85 */     System.out.println("lalalalala.......");
/*     */   }
/*     */ 
/*     */   private boolean insertBackupData(String realPath, String backupWay)
/*     */   {
/*  90 */     if (StringUtils.isEmpty(realPath)) return false;
/*  91 */     if (StringUtils.isEmpty(backupWay)) return false;
/*  92 */     String[] array = new String[3];
/*  93 */     boolean result = false;
/*     */     try {
/*  95 */       array = FileUtils.createExcuteBackUpBatFile(realPath, "2");
/*  96 */       if ((array == null) || (array.length <= 0)) return false;
/*  97 */       if ((array[0] == null) || (array[1] == null) || (array[2] == null)) return false;
/*  98 */       File file = new File(array[2] + array[1]);
/*  99 */       if ((file.exists()) && (file.isFile()))
/*     */       {
/* 101 */         BackupData backupData = new BackupData();
/* 102 */         backupData.setBackupDate(DateUtils.stringDateConvertDate(array[0], "yyyy-MM-dd HH:mm:ss"));
/* 103 */         backupData.setBackupName(array[1]);
/* 104 */         backupData.setBackupWay(backupWay);
/* 105 */         backupData.setPath(array[2]);
/* 106 */         this.backupDataDAO.insertBackupData(backupData);
/*     */ 
/* 108 */         result = true;
/*     */       }
/*     */     } catch (Exception e) {
/* 111 */       e.printStackTrace();
/*     */     }
/* 113 */     return result;
/*     */   }
/*     */ 
/*     */   public static void main(String[] args)
/*     */   {
/*     */   }
/*     */ }

/* Location:           C:\Users\e547415\MyProject\rone\WEB-INF\classes\
 * Qualified Name:     com.feeyin.radar.task.PlanTask
 * JD-Core Version:    0.6.0
 */